/**
 * @(#)AbstractException.java 2011-9-1
 * 
 * Copyright 2000-2011 by ChinanetCenter Corporation.
 *
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * ChinanetCenter Corporation ("Confidential Information").  You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with ChinanetCenter.
 * 
 */

package com.szf.base.exception;

public abstract class AbstractException extends RuntimeException implements IException {

	private static final long serialVersionUID = -3825296384822345147L;

	private String errorMessage = null;
	private String[] args = new String[] {};

	public AbstractException() {
		super();
	}

	public AbstractException(String message, String... args) {
		super(message);
		this.errorMessage = message;
		this.args = args;
	}

	public AbstractException(String message, Throwable cause) {
		super(message, cause);
		this.errorMessage = message;
	}

	public AbstractException(String message, String arg1, Throwable cause) {
		super(message, cause);
		this.errorMessage = message;
		this.args = new String[] { arg1 };
	}

	public AbstractException(String message, String arg1, String arg2, Throwable cause) {
		super(message, cause);
		this.errorMessage = message;
		this.args = new String[] { arg1, arg2 };
	}

	public AbstractException(String message, String arg1, String arg2, String arg3, Throwable cause) {
		super(message, cause);
		this.errorMessage = message;
		this.args = new String[] { arg1, arg2, arg3 };
	}

	public AbstractException(String message, String[] args, Throwable cause) {
		super(message, cause);
		this.errorMessage = message;
		this.args = args;
	}

	@Override
	public String getErrorMessage() {
		return this.errorMessage;
	}

	@Override
	public String[] getErrorMessageArgs() {
		return args;
	}

	/**
	 * 与api v1兼容。推荐改用 {@link #getErrorMessageArgs()}
	 * @return the args
	 */
	public String[] getArgs() {
		return args;
	}

}
